package com.bio.dao.right.impl;

import org.hibernate.criterion.Restrictions;

import com.bio.dao.impl.HibernateDaoImpl;
import com.bio.dao.impl.HibernateQuery;
import com.bio.dao.right.MenuDao;
import com.bio.entity.right.Menu;
import com.bio.utils.Pager;

public class MenuDaoImpl extends HibernateDaoImpl<Menu> implements MenuDao{

	@Override
	public Pager<Menu> findMenusBySuperior(Long superiorId) {
		if(null == superiorId){
			superiorId = 0L;
		}
		return new HibernateQuery<Menu>(this.getSessionFactory(), 
				this.getSession(), Menu.class).setPagination(null)
				                                  .addWhere(Restrictions.eq("superiorId",superiorId)).query();
	}

}
